//
//  AdviceViewController.m
//  项目A --半糖
//
//  Created by romana on 16/5/30.
//  Copyright © 2016年 romana. All rights reserved.
//

#import "AdviceViewController.h"

@interface AdviceViewController ()

@property(nonatomic,strong)UITextField *bigTextField;
@property(nonatomic,strong)UITextField *smallTextField;

@end

@implementation AdviceViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:1];
    self.navigationItem.title = @"意见反馈";
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"提交" style:UIBarButtonItemStylePlain target:self action:@selector(rightBarAction)];
    
     self.bigTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, 74, self.view.frame.size.width, 200)];
    self.bigTextField.backgroundColor = [UIColor whiteColor];
    self.bigTextField.placeholder = @"你有什么不爽统统告诉我们吧!";
    self.bigTextField.textAlignment = NSTextAlignmentLeft;
    [self.view addSubview:self.bigTextField];
  //  [self.bigTextField sizeToFit];
    
    self.smallTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, 284, self.view.frame.size.width, 50)];
    self.smallTextField.backgroundColor = [UIColor whiteColor];
    self.smallTextField.placeholder = @"手机号或qq号,以便发放反馈奖励";
    [self.view addSubview:self.smallTextField];
    NSLog(@"===%@",self.bigTextField.subviews);
    for (UIView *aview in self.bigTextField.subviews) {
        
        NSLog(@"===%@",aview);
    }
    // UITextView
    
    
    
    
    
    // Do any additional setup after loading the view.
}

-(void)rightBarAction{

    if (self.bigTextField.text.length == 0 || self.smallTextField.text.length == 0) {
        
        NSLog(@"123123");  
        UIAlertController *alartController = [UIAlertController alertControllerWithTitle:@"提示" message:@"输入内容不能为空" preferredStyle:UIAlertControllerStyleAlert];
        [alartController addAction:[UIAlertAction actionWithTitle:@"返回" style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:alartController animated:YES completion:^{
            
            
        }];
        

    }else{
        UIAlertController *alartController = [UIAlertController alertControllerWithTitle:@"提示" message:@"我们已收到您的建议并将及时反馈" preferredStyle:UIAlertControllerStyleAlert];
        [alartController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:alartController animated:YES completion:^{
            
            
        }];
        
    
    
    
    }




}


@end
